﻿<%@ Page Title="Edit Order" MasterPageFile="../masterpages/umbracoPage.Master"
    ValidateRequest="false" Language="c#" CodeBehind="editOrder.aspx.cs" AutoEventWireup="True"
    Inherits="CommerceForUmbraco.adminSection.commerce.editOrder" %>

<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<%--  <link rel="stylesheet" type="text/css" href="/css/jquery-ui-1.7.2.custom.css" />
  <script src="/scripts/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
  <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAALwwJn5GWVHGsmlweBesDhTDMEczrG5mvHwFX75QSRhVCbxZmhSUVFUE2ViaAwPecnLptrczFuTFUg"></script>
--%>  
    <link rel="stylesheet" type="text/css" href="/umbraco/css/jquery.autocomplete.css" />
    <script src="/umbraco/js/autocomplete/jquery.autocomplete.js" type="text/javascript"></script>

    <style type="text/css">
        .cartProdOption { display: block; margin: 5px 0 0 15px; }
    </style>
  
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" runat="server">

    <cc1:TabView runat="server" ID="tabControl" Width="552px" Height="692px" />
    
      <cc1:Pane ID="Pane1" runat="server" Height="600px" Width="330px">
        <cc1:PropertyPanel runat="server" ID="pp_ordernumber">
              <asp:Label ID="orderNumber" runat="server" Width="300" CssClass="guiInputText"></asp:Label>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_orderdate">
            <asp:Panel ID="pnlOrderDate" runat="server" >
                <asp:TextBox ID="TextBoxOrderDate" runat="server" CssClass="guiInputText" Width="330px"></asp:TextBox>
            </asp:Panel>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_orderPO">
            <asp:Label ID="LabelPO" runat="server" Width="300" CssClass="guiInputText"></asp:Label>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_paymentReceived">
            <asp:CheckBox ID="CheckBoxPaymentReceived" runat="server" CssClass="guiInputText">
            </asp:CheckBox>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_orderStatus">
            <asp:Label ID="orderStatusDisplay" runat="server" Width="300" CssClass="guiInputText"></asp:Label>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_billto">
              <asp:Label ID="billTo" runat="server" Width="300" CssClass="guiInputText"></asp:Label>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_shipto">
              <asp:Label ID="shipTo" runat="server" Width="300" CssClass="guiInputText"></asp:Label>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_email">
            <asp:Label ID="emailAddress" runat="server" CssClass="guiInputText" Width="300" ></asp:Label>
        </cc1:PropertyPanel>
        <!--<cc1:PropertyPanel runat="server" ID="pp_businessName">
            <asp:Label ID="businessName" runat="server" CssClass="guiInputText" Width="300" ></asp:Label>
        </cc1:PropertyPanel>-->
        <cc1:PropertyPanel runat="server" ID="pp_memberlink">
            <asp:Label ID="memberLink" runat="server" Width="300" CssClass="guiInputText"></asp:Label>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_coupon">
              <asp:Label ID="CouponCodes" runat="server" Width="300" CssClass="guiInputText"></asp:Label>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_IsGift">
              <asp:CheckBox ID="isGift" runat="server" Enabled="false" CssClass="guiInputText" />
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_GiftMessage">
                <asp:TextBox ID="instructionNote" TextMode="MultiLine" Enabled="false" runat="server" Width="300" CssClass="guiInputText"></asp:TextBox>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_shipping_method">
            <asp:DropDownList ID="shippingMethod" runat="server" CssClass="guiInputText" Width="300"></asp:DropDownList>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_shipping_method_actual">
            <asp:TextBox ID="shippingMethodActual" runat="server" CssClass="guiInputText" ReadOnly="true" Width="300"></asp:TextBox>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_tracking">
              <asp:TextBox ID="TrackingNumber" runat="server" Width="300" CssClass="guiInputText"></asp:TextBox>
              <asp:Button ID="shipButton" runat="server" Text="Ship" 
                  onclick="shipButton_Click" />
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_cancel">
            <asp:TextBox ID="cancelNote" runat="server" Width="300" Height="100" CssClass="guiInputText"></asp:TextBox>
            <asp:Button ID="cancelButton" runat="server" Text="Cancel" 
                onclick="cancelButton_Click" />
        </cc1:PropertyPanel>
       </cc1:Pane> 
      <cc1:Pane ID="Pane2" runat="server">
        <cc1:PropertyPanel runat="server" ID="pp_order_items">
              <asp:Label ID="OrderItems" runat="server" CssClass="guiInputText"></asp:Label>
        </cc1:PropertyPanel>
       </cc1:Pane>
      <cc1:Pane ID="Pane3" runat="server">
        <cc1:PropertyPanel ID="pp_notestatus" runat="server">
            <asp:DropDownList ID="orderStatusDDL" runat="server" Width="300" CssClass="guiInputText"></asp:DropDownList>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_notes">
            <asp:TextBox ID="OrderNote" runat="server" Width="300" Height="100" CssClass="guiInputText"></asp:TextBox>
            &nbsp;
            <asp:Button ID="AddNoteButton" runat="server" Text="Add Note" onclick="AddNoteButton_Click" />
        </cc1:PropertyPanel>
            <p>&nbsp;</p>
        <cc1:PropertyPanel ID="pp_notelist" runat="server">
            <asp:GridView ID="gNotes" runat="server" AutoGenerateColumns="False" 
                CssClass="guiInputText" CellPadding="6" ForeColor="#333333" GridLines="None">
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                <Columns>
                <asp:BoundField DataField="createdOn" DataFormatString="{0:d}" HeaderText="Date" />
                <asp:BoundField DataField="Note" HeaderText="Note" />
                <asp:BoundField DataField="OrderStatus" HeaderText="Status" />
                </Columns>
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        	</asp:GridView>
         </cc1:PropertyPanel>
      </cc1:Pane> 
      <cc1:Pane ID="Pane4" runat="server">
       <cc1:PropertyPanel runat="server" ID="pp_transactions">
        <asp:GridView ID="gTransactions" runat="server" AutoGenerateColumns="False" 
               CssClass="guiInputText" CellPadding="6" ForeColor="#333333" GridLines="None">
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <Columns>
                <asp:BoundField DataField="TransactionDate" DataFormatString="{0:d}" HeaderText="Date" />
                <asp:BoundField DataField="Amount" DataFormatString="{0:c}" HeaderText="Amount" HtmlEncode="False" />
                <asp:BoundField DataField="TransactionType" HeaderText="Type" />
                <asp:BoundField DataField="TransactionNotes" HeaderText="Notes" />
            </Columns>
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_transactions_add">
            <div><asp:Label ID="Label1" runat="server" Text="Amount: " AssociatedControlID="addTransactionAmount"></asp:Label></div>
            <asp:TextBox ID="addTransactionAmount" runat="server"></asp:TextBox> (no $ symbol)
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_transactions_addnote">
            <div><asp:DropDownList ID="addTransactionType" runat="server" Enabled="false">
            </asp:DropDownList></div>
            <asp:TextBox ID="addTransactionNote" runat="server" TextMode="MultiLine"></asp:TextBox>
            <asp:Button ID="addTransactionButton" runat="server" Text="Add" 
                onclick="addTransactionButton_Click" />
        </cc1:PropertyPanel>
      </cc1:Pane>
      <cc1:Pane ID="Pane5" runat="server">
        <cc1:PropertyPanel ID="pp_editorder_notestatus" runat="server">
            <asp:DropDownList ID="editOrderStatusDDL" Enabled="false" runat="server" Width="300" CssClass="guiInputText"></asp:DropDownList>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_editorder_notes">
            <asp:TextBox ID="editOrderStatusNote" runat="server" Width="300" Height="100" CssClass="guiInputText"></asp:TextBox>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_editorder_items">
            <asp:Repeater ID="rptBasket" runat="server" OnItemCommand="R1_ItemCommand">
                    <HeaderTemplate>
                        <table class="tblCheckout" cellpadding="0" cellspacing="10" style="width: 500px;">
                        <thead>
                            <tr>
                            <th>SKU</th>
                            <th>Description</th>
                            <th>Price</th>
                            <th>Quantity</th>
                            <th>&nbsp;</th>
                            </tr>
                        </thead>
                        <tbody>
                    </HeaderTemplate>
                <ItemTemplate>
                        <tr class="trOdd">
                            <td><asp:Label ID="lblSKU" runat="server" Text='<%#Eval("sku") %>'></asp:Label></td>
                            <td><nobr><%#Eval("productName") %></nobr> <asp:Label ID="lblAttributes" runat="server" Text='<%#Eval("attributes") %>'></asp:Label></td>
                            <td><%#decimal.Parse(Eval("pricePaid").ToString()).ToString("C") %></td>
                            <td>
                                <asp:TextBox ID="qtyEntry" runat="server" Text='<%#Eval("quantity") %>' Width="20"></asp:TextBox>
                            </td>
                            <td class="tdBtn">
                                <asp:Label ID="lblProductID" runat="server" style="display:none;" Text='<%#Eval("productID") %>'></asp:Label>
                                <nobr><asp:ImageButton ID="updateButton" runat="server" CssClass="hasHover" CommandArgument="update" ImageUrl="/usercontrols/commerce/images/button_update_sm.png" />
                                </nobr>
                            </td>
                        </tr>
                </ItemTemplate>
                <AlternatingItemTemplate>
                        <tr class="trEven">
                            <td><asp:Label ID="lblSKU" runat="server" Text='<%#Eval("sku") %>'></asp:Label></td>
                            <td><nobr><%#Eval("productName") %></nobr> <asp:Label ID="lblAttributes" runat="server" Text='<%#Eval("attributes") %>'></asp:Label></td>
                            <td><%#decimal.Parse(Eval("pricePaid").ToString()).ToString("C") %></td>
                            <td>
                                <asp:TextBox ID="qtyEntry" runat="server" Text='<%#Eval("quantity") %>' Width="20"></asp:TextBox>
                            </td>
                            <td class="tdBtn">
                                <asp:Label ID="lblProductID" runat="server" style="display:none;" Text='<%#Eval("productID") %>'></asp:Label>
                                <nobr><asp:ImageButton ID="updateButton" runat="server" CssClass="hasHover" CommandArgument="update" ImageUrl="/usercontrols/commerce/images/button_update_sm.png" />
                                </nobr>
                            </td>
                        </tr>
                </AlternatingItemTemplate>
                <FooterTemplate>
<%--                        <tr class="trSub">
                            <td colspan="2">Sub Total:</td>
                            <td colspan="2"><span class="cartTotal"><%=decimal.Parse(orderSubTotal.ToString()).ToString("C") %></span></td>
                        </tr>
                        <tr class="trEven">
                            <td colspan="4">
                            <!--&nbsp;You may checkout using any of the methods below-->
                            </td>
                        </tr>      --%>      
                        </tbody>
                    </table>
                </FooterTemplate>
            </asp:Repeater>
        </cc1:PropertyPanel>
        
        <cc1:PropertyPanel runat="server" ID="pp_editorder_newitem">
            <asp:TextBox ID="editOrder_AddProduct" CssClass="productsAutocomplete" Width="300" runat="server"></asp:TextBox>
            <asp:Button ID="editOrder_AddButton" runat="server" Text="Add" 
                onclick="editOrder_AddButton_Click" />
        </cc1:PropertyPanel>
        
      </cc1:Pane>
       
      <script type="text/javascript">
      
          $(document).ready(function() {
              $(".productsAutocomplete").autocomplete(products);

          });

          function printWindow(id) {
              window.open('printOrder.aspx?o=' + id);
          }       
      </script> 
      
      <asp:PlaceHolder ID="autocompleteArray" runat="server"></asp:PlaceHolder>
       
</asp:Content>